package models

import (
	"time"
)

// Payment 支付模型
type Payment struct {
	ID            uint      `json:"id" gorm:"primaryKey"`
	OrderID       string    `json:"order_id" gorm:"uniqueIndex;size:50;not null"`
	UserID        uint      `json:"user_id" gorm:"index;not null"`
	Amount        float64   `json:"amount" gorm:"type:decimal(10,2);not null"`
	Currency      string    `json:"currency" gorm:"size:3;not null"`
	Status        int       `json:"status" gorm:"default:0"` // 0: 待支付, 1: 支付成功, 2: 支付失败
	PaymentMethod string    `json:"payment_method" gorm:"size:20;not null"`
	PaymentTime   time.Time `json:"payment_time"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

// CreatePaymentRequest 创建支付请求
type CreatePaymentRequest struct {
	OrderID       string  `json:"order_id" binding:"required"`
	Amount        float64 `json:"amount" binding:"required,gt=0"`
	Currency      string  `json:"currency" binding:"required,len=3"`
	PaymentMethod string  `json:"payment_method" binding:"required"`
}

// PaymentResponse 支付响应
type PaymentResponse struct {
	ID            uint      `json:"id"`
	OrderID       string    `json:"order_id"`
	Amount        float64   `json:"amount"`
	Currency      string    `json:"currency"`
	Status        int       `json:"status"`
	PaymentMethod string    `json:"payment_method"`
	PaymentTime   time.Time `json:"payment_time"`
	CreatedAt     time.Time `json:"created_at"`
} 